﻿using System.Collections;

namespace ApplicationGenerator.CommonModule
{
    /// <summary>
    /// Tworzy konfigiurację w pamięci dla ActiveRecord
    /// </summary>
    public class ActiveRecordConfiguration
    {
        /// <summary>
        /// Nazwa docelowej dll'ki z modelami
        /// </summary>
        public const string AssemblyName = "BusinessModels.dll";

        /// <summary>
        /// Tworzy konfigurację ActiveRecord
        /// </summary>
        /// <param name="connectionString">ConnectionString do bazy danych</param>
        /// <returns>Konfiguracja ActiveRecord</returns>
        public static Hashtable GetConfiguration(string connectionString)
        {
            Hashtable properties = new Hashtable();

            properties.Add("hibernate.connection.driver_class", "NHibernate.Driver.SqlClientDriver");
            properties.Add("hibernate.dialect", "NHibernate.Dialect.MsSql2005Dialect");
            properties.Add("hibernate.connection.provider", "NHibernate.Connection.DriverConnectionProvider");
            properties.Add("hibernate.connection.connection_string", connectionString);

            return properties;
        }
    }
}
